package com.study.security.core.validate.code.repository;

import com.study.security.core.validate.code.entity.ValidateCode;
import com.study.security.core.validate.code.enums.ValidateCodeType;
import org.springframework.web.context.request.ServletWebRequest;

/**
 * 保存验证码的媒介
 * @author LiYongKui
 * @version 1.0
 * @date 2021/4/7 16:24
 */
public interface ValidateCodeRepository {

    /**
     * 保存验证码
     * @param request
     * @param code
     * @param validateCodeType
     */
    void save(ServletWebRequest request, ValidateCode code, ValidateCodeType validateCodeType);

    /**
     * 获取验证码
     * @param request
     * @param validateCodeType
     * @return
     */
    ValidateCode get(ServletWebRequest request,ValidateCodeType validateCodeType);

    /**
     * 移除验证码
     * @param request
     * @param validateCodeType
     */
    void remove(ServletWebRequest request,ValidateCodeType validateCodeType);
}
